
//JETNUKE

/*
* Copyright (c) 2004-2006 by Andrea Mazzolini [andreamazzolini@users.sourceforge.net]
* http://www.jetnuke.org
* 
* 
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307, USA.
*  
*/
package org.jetnuke.modules.admin.blocks;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.ActionForward;
import org.jetnuke.common.IAction;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IModuleInfo;
import org.jetnuke.common.IUserInfo;
import org.jetnuke.dao.DataAccessDriver;
import org.jetnuke.entities.HeadLine;
import org.jetnuke.util.JetUtil;

public class AddRssSetup implements IAction {

	String title,url;
	public void setTitle(String title) {
		this.title = title;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	/* (non-Javadoc)
	 * @see org.jetnuke.common.IAction#exec(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.VelocityContext, org.jetnuke.common.IModuleInfo, java.lang.String, org.jetnuke.common.IUserInfo, org.jetnuke.common.IAdminInfo)
	 */
	public ActionForward exec(HttpServletRequest request,
			HttpServletResponse response, VelocityContext vc, IModuleInfo info,
			String op, IUserInfo ui, IAdminInfo ai) throws Exception {
		if (ai == null || !ai.IsSuperUser())
			return null;//Error;
		HeadLine hl=new HeadLine();
		hl.setHEADLINESURL(url);
		hl.setSITENAME(title);
		DataAccessDriver.getInst().newHeadLinesDAO().addNew(hl);
		JetUtil.redirect(vc,response,request.getContextPath()+"/do/admin/setup_rss");
		return null;
	}

}
